<?php

/**
 * Horario filter form base class.
 *
 * @package    blackDrums
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseHorarioFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'horaInicio' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'horaFin'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'dia'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'idSala'     => new sfWidgetFormPropelChoice(array('model' => 'Sala', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'horaInicio' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'horaFin'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'dia'        => new sfValidatorPass(array('required' => false)),
      'idSala'     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Sala', 'column' => 'idSala')),
    ));

    $this->widgetSchema->setNameFormat('horario_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Horario';
  }

  public function getFields()
  {
    return array(
      'idHorario'  => 'Number',
      'horaInicio' => 'Date',
      'horaFin'    => 'Date',
      'dia'        => 'Text',
      'idSala'     => 'ForeignKey',
    );
  }
}
